package com.pms.actions;

import java.util.Hashtable;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.pms.businesslogic.BusinessDelegator;
import com.pms.businesslogic.LogicFactory;
import com.pms.platform.dto.User;
import com.pms.utils.Converter;
import com.pms.utils.ValueObject;
import com.pms.framework.JSPUtility;

public class DeleteAction extends FillComboAction{
	public void execute(HttpServletRequest request, HttpServletResponse response) {
		Hashtable error = (Hashtable) request.getAttribute("error");

		if(error!=null && error.size() > 0){
			return;
		}
		try{

			ValueObject inValObj=Converter.convertToValueObject(request);
			User user=(User)request.getSession().getAttribute("user");
			inValObj.put("user", user);
			
			int actionEvent =JSPUtility.GetInt(request,"actionEvent");
			
			
			
			BusinessDelegator blObj= LogicFactory.getInstance().getBusinessLogic(actionEvent);
			
			ValueObject outValObj=blObj.delete(inValObj);
			
			outValObj.transferToRequest(request);
			
			super.execute(request, response);
			request.setAttribute("nextPageToken", "success");
			
			
		}catch (Exception e) {
			e.printStackTrace();
		}

	}

}
